package com.xongxong.admin.service.impl;

import com.xongxong.admin.domain.dto.loginDto;
import com.xongxong.admin.domain.po.User;
import com.xongxong.admin.mapper.UserMapper;
import com.xongxong.admin.service.IUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author dxx
 * @since 2024-10-15
 */
@Slf4j
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public User login(loginDto loginDto) {
        String userName = loginDto.getUserName();
        String password = loginDto.getPassword();
        if (userName == null && password == null){
            throw new RuntimeException("账号或密码为空");
        }
        return userMapper.login(loginDto);
    }
}
